﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace CoreModule.Converters
{
    /// <summary>
    /// 
    /// </summary>
    public class VaporResultToColorConverter : IValueConverter
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vaporResult = value.ToString();

            if (vaporResult == CoreModule.VaporResult.合格.ToString())
            {
               return new SolidColorBrush(Colors.Green);
            }
            else if (vaporResult== CoreModule.VaporResult.不合格.ToString())
            {
              return new SolidColorBrush(Colors.Red);

            }
            else if (vaporResult == CoreModule.VaporResult.偏大.ToString())
            {
                   return new SolidColorBrush(Colors.Purple);
            }
            else
            {
                return new SolidColorBrush(Colors.Black);
            }

        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}